package com.example.orcaltest.controller;

import com.example.orcaltest.common.YDPResponse;
import com.example.orcaltest.entity.PbcgzGzdytb;
import com.example.orcaltest.entity.PbcgzGzdytbDTO;
import com.example.orcaltest.service.IPbcgzGzdytbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/pbcgzGzdytb")
@CrossOrigin
public class PbcgzGzdytbController {

    @Autowired
    private IPbcgzGzdytbService pbcgzGzdytbService;

    /**
     * list
     */
    @PostMapping("/list")
    public ResponseEntity list(@RequestBody PbcgzGzdytbDTO dto) {
        List<PbcgzGzdytb> list = pbcgzGzdytbService.list(dto);
        return YDPResponse.success(list);
    }

    /**
     * add
     */
    @PostMapping("/add")
    public ResponseEntity add(@RequestBody PbcgzGzdytb record) {
        pbcgzGzdytbService.add(record);
        return YDPResponse.success();
    }

    /**
     * update
     */
    @PostMapping("/update")
    public ResponseEntity update(@RequestBody PbcgzGzdytb record) {
        pbcgzGzdytbService.update(record);
        return YDPResponse.success();
    }

    /**
     * 批量删除
     */
    @PostMapping("/batchDelete")
    public ResponseEntity batchDelete(@RequestBody List<String> ids) {
        pbcgzGzdytbService.batchDelete(ids);
        return YDPResponse.success();
    }

    /**
     * update
     */
    @PostMapping("/batchUpdateStatus")
    public ResponseEntity batchUpdateStatus(@RequestBody List<String> ids) {
        pbcgzGzdytbService.batchUpdateStatus(ids);
        return YDPResponse.success();
    }
}